﻿using System.Collections.Generic;
using Crocodile.AbstractLanguage.Tree;
using JetBrains.Annotations;



namespace Crocodile.CsharpLanguage.Tree
{
    /// <summary>
    /// C# file.
    /// </summary>
    public class CsFile : CsEntity
    {

        /// <summary>
        /// File header.
        /// </summary>
        public string Header;

        /// <summary>
        /// Namespace references (the 'using' directives).
        /// </summary>
        public readonly ISet<string> Usings = new SortedSet<string>();


        /// <summary>
        /// Namespaces.
        /// </summary>
        [NotNull]
        public readonly Nest<CsFile,CsNamespace> Namespaces;


        public CsFile()
        {
            Namespaces = new Nest<CsFile,CsNamespace>(this);
        }


        public CsModule Module { get {return Parent as CsModule;} }


        public override string FullName
        {
            get 
            { 
                var m = Module;
                return m ? m.RootNamespace : null;
            }
        }
    }
}
